/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.almori.hr.timetracker;
import java.util.Calendar;
/**
 *
 * @author nbenavidez
 */
public class testDates {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        int day = cal.get(Calendar.DATE);
        int month = cal.get(Calendar.MONTH) + 1;
        int year = cal.get(Calendar.YEAR);
        int dow = cal.get(Calendar.DAY_OF_WEEK);
        int dom = cal.get(Calendar.DAY_OF_MONTH);
        int doy = cal.get(Calendar.DAY_OF_YEAR);
 
        System.out.println("Current Date: " + cal.getTime());
        System.out.println("Day: " + day);
        System.out.println("Month: " + month);
        System.out.println("Year: " + year);
        System.out.println("Day of Week: " + dow);
        System.out.println("Day of Month: " + dom);
        System.out.println("Day of Year: " + doy);
        TimeTrackerDAO dao = new TimeTrackerDAO();
        // I need the current 15 days of the month and last ones of last month
        if(day < 16)
        {
            System.out.println("Print current 15th days");  
            for (int i1 = 0; i1 < day; i1++)
            {
                 System.out.println((i1 + 1) + "-" + month + "-" + year );
            }
            System.out.println("Print last 15th days");
            if(month == 1) { year--; month = 12; }
            else { month--; }
            for (int i = 15; i < cal.getActualMaximum(cal.DAY_OF_MONTH); i++)
            {
                 System.out.println((i + 1) + "-" + month + "-" + year );
            }
        }
        else
        {
            System.out.println("Print current 15th days");
            for (int i2 = 15; i2 < day; i2++)
            {
                 System.out.println((i2 + 1) + "-" + month + "-" + year );
            }
            System.out.println("Print last 15th days");
            for (int i = 0; i < 15; i++)
            {
                 System.out.println((i + 1) + "-" + month + "-" + year );
            }
        }
    }
}
